import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

//1.导入页面
import Login from '@/views/Login.vue'
import Register from '@/views/Register.vue'
import Main from '@/views/Main.vue'
//导入二级路由
import Home from '@/views/Home/Home.vue'
import ArtCate from '@/views/Article/ArtCate.vue'
import ArtList from '@/views/Article/ArtList.vue'
import UserInfo from '@/views/User/UserInfo.vue'
import UserAvatar from '@/views/User/UserAvatar.vue'
import UserPwd from '@/views/User/UserPwd.vue'

//2.创建路由规则 (路径与页面对应)
const routes = [
  { path:'/register',component:Register },
  { path:'/login',component:Login },
  { path:'/',component:Main,children:[
    { path:'/',component:Home },
    { path:'/home',component:Home },
    { path:'/art-cate',component:ArtCate },
    { path:'/art-list',component:ArtList },
    { path:'/user-info',component:UserInfo },
    { path:'/user-avatar',component:UserAvatar },
    { path:'/user-pwd',component:UserPwd },
  ] },
]


//3.创建路由对象 (管理路由规则)
const router = new VueRouter({
  routes
})

export default router
